//
//  CommunityWriteTopicController.m
//  ArtDog
//
//  Created by dllo on 16/9/24.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CommunityWriteTopicController.h"
#import "BaseTableView.h"
#import "HLMacro.h"
#import "WriteTopicTextAndImageTableCell.h"

@interface CommunityWriteTopicController ()<UITableViewDelegate, UITableViewDataSource>

@end

@implementation CommunityWriteTopicController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupNavigation];
    [self createTableView];
}

#pragma mark - navagation
- (void)setupNavigation
{
    self.title = @"话题";
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"发送" style:UIBarButtonItemStylePlain target:self action:@selector(sendAction:)];
}

- (void)sendAction:(UIBarButtonItem *)send
{
    
}

- (NSMutableArray *)imageArray
{
    if (!_imageArray) {
        _imageArray = [NSMutableArray array];
    }
    return _imageArray;
}

#pragma mark - tableView
- (void)createTableView
{
    _tableView = [[BaseTableView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - 64) style:UITableViewStylePlain];
    [self.view addSubview:_tableView];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    [_tableView registerNib:[UINib nibWithNibName:@"WriteTopicTextAndImageTableCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"writeTopicTextAndImageTableCell"];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 5;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    WriteTopicTextAndImageTableCell *cell = [tableView dequeueReusableCellWithIdentifier:@"writeTopicTextAndImageTableCell"];
    cell.imageArray = _imageArray;
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return [WriteTopicTextAndImageTableCell getHeight];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}
@end
